/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.view;

import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.Vector;

import javax.swing.ButtonGroup;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;

import com.ruipengkj.ApplicationContext;
import com.ruipengkj.commons.util.Util;
import com.ruipengkj.component.RPSmailToolBarJButton;
import com.ruipengkj.delegate.DialogDelegale;
import com.ruipengkj.factory.ImageFactory;
import com.ruipengkj.factory.UIFactory;
import com.ruipengkj.view.baseDataView.DataCommodityPanel;
import com.ruipengkj.view.baseDataView.DataEmployeesPanel;
import com.ruipengkj.view.baseDataView.DataExePosPanel;
import com.ruipengkj.view.baseDataView.DataManagerPanel;
import com.ruipengkj.view.baseDataView.DataShopPanel;
import com.ruipengkj.view.baseDataView.DataStoragePanel;
import com.ruipengkj.view.baseDataView.DataSupplierPanel;
import com.ruipengkj.view.memberView.MemberCardPanel;
import com.ruipengkj.view.memberView.MemberCoupon;
import com.ruipengkj.view.memberView.MemberCreateCardPanel;
import com.ruipengkj.view.memberView.MemberFillCardPanel;
import com.ruipengkj.view.memberView.MemberGiftPanel;
import com.ruipengkj.view.memberView.MemberLostCardPanel;
import com.ruipengkj.view.memberView.MemberManagerPanel;
import com.ruipengkj.view.memberView.MemberQueryCardPanel;
import com.ruipengkj.view.memberView.NewsPanel;
import com.ruipengkj.view.memberView.PermissionsFrame;
import com.ruipengkj.view.memberView.PermissionsPanel;
import com.ruipengkj.view.memberView.ShiftTypePanel;
import com.ruipengkj.view.memberView.ShopChargePanel;
import com.ruipengkj.view.orderView.AllPanel;
import com.ruipengkj.view.orderView.MarketReturnedPanel;
import com.ruipengkj.view.orderView.OrderManagerPanel;
import com.ruipengkj.view.orderView.OrderOnlinePanel;
import com.ruipengkj.view.orderView.OrderScheduledPanel;
import com.ruipengkj.view.orderView.desk.DeskMianPanel;
import com.ruipengkj.view.orderView.dish.OrderAddPanel;
import com.ruipengkj.view.purchaseView.PurchaseEnterPanel;
import com.ruipengkj.view.purchaseView.PurchaseManagerPanel;
import com.ruipengkj.view.purchaseView.PurchaseRetreatPanel;
import com.ruipengkj.view.reserveView.ArticlesUsingPanel;
import com.ruipengkj.view.reserveView.CommodityDamagePanel;
import com.ruipengkj.view.reserveView.OtherReservePanel;
import com.ruipengkj.view.reserveView.ReserveManagerPanel;
import com.ruipengkj.view.reserveView.StockAlarmPanel;
import com.ruipengkj.view.reserveView.StockInOutQuery;
import com.ruipengkj.view.reserveView.StoreTransferPanel;
import com.ruipengkj.view.statementView.StatementBuyPanel;
import com.ruipengkj.view.statementView.StatementManagerPanel;
import com.ruipengkj.view.statementView.StatementMoneyPanel;
import com.ruipengkj.view.statementView.StatementProfitPanel;
import com.ruipengkj.view.statementView.StatementSalesPanel;
import com.ruipengkj.view.statementView.StatementStockPanel;
import com.ruipengkj.view.systemView.MarkePanel;
import com.ruipengkj.view.systemView.MarketingFrame;
import com.ruipengkj.view.systemView.SelectCouponPanel;
import com.ruipengkj.view.systemView.SelectGiftPanel;
import com.ruipengkj.view.systemView.ShopJobPanel;
import com.ruipengkj.view.systemView.SystemBackupReduction;
import com.ruipengkj.view.systemView.SystemManageBarCode;
import com.ruipengkj.view.systemView.SystemManageLog;
import com.ruipengkj.view.systemView.SystemManagePrivilege;
import com.ruipengkj.view.systemView.SystemManagerPanel;
import com.ruipengkj.view.systemView.SystemSetAllocation;
import com.ruipengkj.view.workShiftView.AllWorkShiftPanel;
import com.ruipengkj.view.workShiftView.AllWorkShiftTakeNotesPanel;

public class RPToolBar extends JPanel implements ActionListener{

	private static final long serialVersionUID = 1L;
//	private ImageIcon backgroundImageIcon = ImageFactory.loadImage(ImageFactory.TOOLBAR_BG);
//	private TexturePaint paint = Util.createTexturePaint(backgroundImageIcon.getImage());
//	private Image backgroundLeftImage = ImageFactory.loadImage(ImageFactory.TOOLBAR_LEFT_BG).getImage();
//	private Image backgroundRightImage = ImageFactory.loadImage(ImageFactory.TOOLBAR_RIGHT_BG).getImage();
	
	private UIFactory uiFactory=UIFactory.getInstance();
	private JToggleButton memberButton;//会员管理按钮
	private JToggleButton orderButton;//订单管理按钮
	private JToggleButton dataButton;//基础数据管理按钮
	private JToggleButton purchaseButton;//进货管理
	private JToggleButton reserveButton;//库存管理
	private JToggleButton journalingButton;//报表管理
	private JToggleButton systemButton;//系统设置
	private JToggleButton openUrlButton;//打开网站
	
	//营销管理------------
	private JToggleButton marketingButton;
	
	//权限管理
	private JToggleButton permissionButton;
	
	/**订单管理*/
	private OrderManagerPanel orderManagerPanel;//订单管理按钮
	private DeskMianPanel deskMianPanel =new DeskMianPanel();//预订主面板
//	private DeskMianPanel deskMianPanel =new DeskMianPanel();//外卖面板
	private OrderAddPanel orderAddPanel=new OrderAddPanel();//会员消费面板
	private OrderOnlinePanel orderOnlinePanel=new OrderOnlinePanel();//在线订面板
	private OrderScheduledPanel orderScheduledPanel=new OrderScheduledPanel();//在线预订单面板
	private AllPanel orderCommentsPanel=new AllPanel();//订单评论面板OrderCommentsPanel
	private MarketReturnedPanel marketReturnedPanel=new MarketReturnedPanel();//销售退货单面板
	/**会员管理*/
	private MemberManagerPanel memberManagerPanel;//会员管理窗体
	private MemberFillCardPanel menberFillCardPanel=new MemberFillCardPanel();//会员充值面板
	private MemberQueryCardPanel meberQueryCardPanel=new MemberQueryCardPanel();//会员卡查询面板
	private MemberCreateCardPanel menberCreateCardPanel=new MemberCreateCardPanel(); //发卡面板
	private MemberGiftPanel menberGiftPanel=new MemberGiftPanel();//会员领取礼包面板
	private MemberLostCardPanel menberLostCardPanel=new MemberLostCardPanel();//会员补卡面板
	/**基础数据管理*/
	private DataManagerPanel dataManagerPanel;//基础数据管理窗体
	private DataCommodityPanel dataCommodityPanel=new DataCommodityPanel();//商品管理面板
	private DataEmployeesPanel dataEmployeesPanel=new DataEmployeesPanel();//员工管理面板
	private DataExePosPanel dataExePosPanel=new DataExePosPanel();//餐桌管理面板
	private DataStoragePanel dataStoragePanel=new DataStoragePanel();//仓库管理面板
	private DataSupplierPanel dataVendorPanel=new DataSupplierPanel();//供应商管理面板
	private DataShopPanel dataShopPanel=new DataShopPanel();//商店管理面板
	/**进货管理*/
	private PurchaseManagerPanel purchaseManagerPanel;//进货管理窗体
	private PurchaseEnterPanel purchaseEnterPanel=new PurchaseEnterPanel();//进货面板
	private PurchaseRetreatPanel purchaseRetreatPanel=new PurchaseRetreatPanel();//退货面板
	/**库存管理*/
	private ReserveManagerPanel reserveManagerPanel;//库存管理窗体
	private CommodityDamagePanel commodityDamagePanel=new CommodityDamagePanel();//商品报损面板
	private ArticlesUsingPanel articlesUsingPanel=new ArticlesUsingPanel();//物品领用面板
	private OtherReservePanel otherReservePanel=new OtherReservePanel();//其他方式出库存单面板
	private StoreTransferPanel reserveAllotPanel=new StoreTransferPanel();//仓库调拨面板
	private StockAlarmPanel stockAlarmPanel=new StockAlarmPanel();//库存报警面板
	private StockInOutQuery stockInOutQuery=new StockInOutQuery();//出入库存单查询面板
	/**报表管理*/
	private StatementManagerPanel statementManagerPanel=new StatementManagerPanel();//报表管理窗体
	private StatementBuyPanel statementBuyPanel=new StatementBuyPanel();//采购报表面板
	private StatementStockPanel statementStockPanel=new StatementStockPanel();//库存报表面板
	private StatementSalesPanel statementSalesPanel=new StatementSalesPanel();//销售报表面板
	private StatementMoneyPanel statmentMoneyPanel=new StatementMoneyPanel();//资金报表面板
	private StatementProfitPanel statementProfitPanel=new StatementProfitPanel();//利润报表面板
	private AllWorkShiftTakeNotesPanel allWorkShiftTakeNotesPanel=new AllWorkShiftTakeNotesPanel();//所有员工交班记录
	/**系统设置*/
	private SystemManagerPanel systemManagerPanel;//系统设置面板
	private SystemManageLog systemManageLog=new SystemManageLog();//操作日志管理面板
	private SystemManagePrivilege systemManagePrivilege=new SystemManagePrivilege();//角色管理面板
	private SystemSetAllocation systemSetAllocation=new SystemSetAllocation();//系统配置设置面板
	private SystemManageBarCode systemManageBarCode=new SystemManageBarCode();//条形码生成管理面板
	private SystemBackupReduction SystemBackupReduction=new SystemBackupReduction();//数据库备份还原面板
	private AllWorkShiftPanel workShiftPanel=new AllWorkShiftPanel();//交班面板
//	private WorkShiftTakeNotesPanel workShiftTakeNotesPanel=new WorkShiftTakeNotesPanel();//交班信息面板
	
	//营销管理
	/**营销管理*/
	private  MarketingFrame systemMarketingFrame;  
	private SelectGiftPanel	selectGiftPanel=new SelectGiftPanel(); //满就送
	private SelectCouponPanel selectCouponPanel=new SelectCouponPanel(); //自定义优惠
	private MarkePanel markePanel=new MarkePanel(); //营销评估
    private ShopJobPanel	shopJobPanel=new ShopJobPanel(); //招聘管理
    private MemberCoupon memberCouponPanel=new MemberCoupon();//优惠卷面板
    
    //权限管理
    private  PermissionsFrame permissionsFrame;  
    private PermissionsPanel permissionsPanel=new PermissionsPanel();//权限管理面板
    private ShopChargePanel shopChargePanel=new ShopChargePanel();//充值规则面板
    private MemberCardPanel memberCardPanel=new MemberCardPanel();//会员卡查询
    private NewsPanel newsPanel=new NewsPanel();//新闻管理
    private ShiftTypePanel shiftTypePanel=new ShiftTypePanel();//轮牌管理面板
	
	private Toolkit toolkit =  Toolkit.getDefaultToolkit();
	private RPSmaillToolBar shortcutPane;
	private DialogDelegale dialogDelegale;
	public RPToolBar(RPSmaillToolBar shortcutPane){
		this.setOpaque(false);
		this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, -5));
//		this.setFloatable(false);//设置工具栏不可移动
		this.shortcutPane=shortcutPane;
		this.initViews();
		toolkit.addAWTEventListener(new CapListener(),AWTEvent.KEY_EVENT_MASK); 
		Util.setSize(this, 0, 98);
	}
	//添加键盘监听
	private int onNumber=0;
	
	private void initViews(){
		
		orderManagerPanel=new OrderManagerPanel(this);//订单管理按钮
		memberManagerPanel=new MemberManagerPanel(this);//会员管理窗体
		dataManagerPanel=new DataManagerPanel(this);//基础数据管理窗体
		purchaseManagerPanel=new PurchaseManagerPanel(this);//进货管理窗体
		reserveManagerPanel=new ReserveManagerPanel(this);//库存管理窗体
		systemManagerPanel=new SystemManagerPanel(this);//系统设置面板
		systemMarketingFrame =new MarketingFrame(this); //营销评估
		permissionsFrame = new PermissionsFrame(this);//权限管理
		
		ButtonGroup cbGroup=new ButtonGroup();
		openUrlButton=uiFactory.createRPToolBarJButton("网站向导", ImageFactory.loadImage(ImageFactory.TITLE_8),ImageFactory.loadImage(ImageFactory.TITLE_8_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
		openUrlButton.setForeground(Color.WHITE);
		
		this.add(new JLabel("                                  "));
		//订单管理
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL1)){
			orderButton=uiFactory.createRPToolBarJButton("订单管理", ImageFactory.loadImage(ImageFactory.TITLE_1),ImageFactory.loadImage(ImageFactory.TITLE_1_ENTER), SwingConstants.CENTER, SwingConstants.BOTTOM, this);
			orderButton.setForeground(Color.WHITE);
			cbGroup.add(orderButton);
			this.add(orderButton);
		}
		//会员管理
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL2)){
			memberButton=uiFactory.createRPToolBarJButton("会员卡管理", ImageFactory.loadImage(ImageFactory.TITLE_2),ImageFactory.loadImage(ImageFactory.TITLE_2_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
			memberButton.setForeground(Color.WHITE);
			cbGroup.add(memberButton);
			this.add(memberButton);
		}
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL1)||ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL2)){
//			this.addSeparator();
		}
		//基础数据管理
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL3)){
			dataButton =uiFactory.createRPToolBarJButton("基础数据管理", ImageFactory.loadImage(ImageFactory.TITLE_3),ImageFactory.loadImage(ImageFactory.TITLE_3_ENTER), SwingConstants.CENTER, SwingConstants.BOTTOM, this);
			dataButton.setForeground(Color.WHITE);
			cbGroup.add(dataButton);
			this.add(dataButton);
		}
		//进货管理
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL4)){
			purchaseButton=uiFactory.createRPToolBarJButton("进货管理", ImageFactory.loadImage(ImageFactory.TITLE_4), ImageFactory.loadImage(ImageFactory.TITLE_4_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
			purchaseButton.setForeground(Color.WHITE);
			cbGroup.add(purchaseButton);
			this.add(purchaseButton);
		}
		//库存管理
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL6)){
			reserveButton=uiFactory.createRPToolBarJButton("库存管理",ImageFactory.loadImage(ImageFactory.TITLE_5), ImageFactory.loadImage(ImageFactory.TITLE_5_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
			reserveButton.setForeground(Color.WHITE);
			cbGroup.add(reserveButton);
			this.add(reserveButton);
		}
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL4)||ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL5)||ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL6)){
//			this.addSeparator();
		}
		//报表管理
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL7)){
			journalingButton=uiFactory.createRPToolBarJButton("报表管理", ImageFactory.loadImage(ImageFactory.TITLE_6),ImageFactory.loadImage(ImageFactory.TITLE_6_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
			journalingButton.setForeground(Color.WHITE);
			cbGroup.add(journalingButton);
			this.add(journalingButton);
//			this.addSeparator();
		}
//		//营销管理
//		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL012)){
//			marketingButton=uiFactory.createRPToolBarJButton("营销管理",ImageFactory.loadImage(ImageFactory.TITLE_8), ImageFactory.loadImage(ImageFactory.TITLE_8_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
//			marketingButton.setForeground(Color.WHITE);
//			cbGroup.add(marketingButton);
//			this.add(marketingButton);
//		}
		//系统设置
		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL8)){
			systemButton=uiFactory.createRPToolBarJButton("系统设置",ImageFactory.loadImage(ImageFactory.TITLE_7), ImageFactory.loadImage(ImageFactory.TITLE_7_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
			systemButton.setForeground(Color.WHITE);
			cbGroup.add(systemButton);
			cbGroup.add(openUrlButton);this.add(systemButton);
		}
		//权限管理
//		if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL011)){
//			permissionButton=uiFactory.createRPToolBarJButton("权限管理",ImageFactory.loadImage(ImageFactory.TITLE_3), ImageFactory.loadImage(ImageFactory.TITLE_3_ENTER),SwingConstants.CENTER, SwingConstants.BOTTOM, this);
//			permissionButton.setForeground(Color.WHITE);
//			cbGroup.add(permissionButton);
//			cbGroup.add(permissionButton);this.add(permissionButton);
//		}
		
		
		this.add(openUrlButton);
	}
	
	private Vector<JToggleButton> ves=new Vector<JToggleButton>();
	@Override
	public void actionPerformed(ActionEvent e) {
		ves.clear();
		if(e.getSource()==orderButton){
			//订单管理
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL11)){
				ves.add(createButton("销售订单 ",ImageFactory.loadImage(ImageFactory.FUN_1_ICON_1_1),this.memberConsumptionAction));
			}
			
			ves.add(createButton("预订下单",ImageFactory.loadImage(ImageFactory.FUN_1_ICON_1_1),this.memberBookAction));
			ves.add(createButton("外卖",ImageFactory.loadImage(ImageFactory.FUN_1_ICON_1_1), null));
			
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL12)){
				ves.add(createButton("在线订单",ImageFactory.loadImage(ImageFactory.FUN_1_ICON_2_2),this.orderOnlineAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL13)){
				ves.add(createButton("在线预订单",ImageFactory.loadImage(ImageFactory.FUN_1_ICON_3_3),this.orderScheduledAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL14)){
				 ves.add(createButton("订单评论",ImageFactory.loadImage(ImageFactory.FUN_1_ICON_4_4),this.orderCommentsAction));
			}

			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL15)){
				 ves.add(createButton("销售退货单",ImageFactory.loadImage(ImageFactory.FUN_1_ICON_5_5),this.marketReturnedAction));
			}
//            shortcutPane.setTitle("订单管理");
            orderManagerPanel.setName("订单管理");
     		dialogDelegale.addJComponent(orderManagerPanel);
		}else if(e.getSource()==memberButton){
			//会员卡管理
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL21)){
				ves.add(createButton("会员发卡",ImageFactory.loadImage(ImageFactory.FUN_2_ICON_1_1),this.memberCreateCardAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL22)){
				  ves.add(createButton("会员补卡",ImageFactory.loadImage(ImageFactory.FUN_2_ICON_2_2),this.memberLostCardAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL23)){
				ves.add(createButton("会员卡查询",ImageFactory.loadImage(ImageFactory.FUN_2_ICON_3_3),this.meberQueryCardAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL24)){
				 ves.add(createButton("会员卡充值",ImageFactory.loadImage(ImageFactory.FUN_2_ICON_4_4),this.memberFillCardAction));
			}
			
//            shortcutPane.setTitle("会员卡管理");
            memberManagerPanel.setName("会员管理");
     		dialogDelegale.addJComponent(memberManagerPanel);
		}else if(e.getSource()==dataButton){
			//基础数据管理
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL31)){
				ves.add(createButton( "商品管理",ImageFactory.loadImage(ImageFactory.FUN_3_ICON_1_1),this.dataCommodityAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL32)){
				ves.add(createButton( "员工管理",ImageFactory.loadImage(ImageFactory.FUN_3_ICON_2_2),this.dataEmployeesAction));
			}
			
			ves.add(createButton( "餐桌管理",ImageFactory.loadImage(ImageFactory.FUN_3_ICON_2_2),this.dataExePosAction));
			
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL33)){
				ves.add(createButton( "仓库管理",ImageFactory.loadImage(ImageFactory.FUN_3_ICON_3_3),this.dataStorageAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL34)){
				ves.add(createButton("供应商管理",ImageFactory.loadImage(ImageFactory.FUN_3_ICON_4_4),this.dataSupplierAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL31)){
				ves.add(createButton("商店管理", ImageFactory.loadImage(ImageFactory.test_icon), this.dataShopAction));
			}
			//			shortcutPane.setTitle("基础数据管理");
			dataManagerPanel.setName("基础数据管理");
			dialogDelegale.addJComponent(dataManagerPanel);
		}else if(e.getSource()==purchaseButton){
			//进货管理
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL41)){
				ves.add(createButton("采购进货", ImageFactory.loadImage(ImageFactory.FUN_4_ICON_1_1),this.purchaseEnterAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL42)){
				ves.add(createButton("采购退货", ImageFactory.loadImage(ImageFactory.FUN_4_ICON_2_2),this.purchaseRetreatAction));
			}
			//shortcutPane.setTitle("进货管理");
			purchaseManagerPanel.setName("进货管理");
     		dialogDelegale.addJComponent(purchaseManagerPanel);
		}else if(e.getSource()==reserveButton){
			//库存管理
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL61)){
				ves.add(createButton( "仓库调拨", ImageFactory.loadImage(ImageFactory.FUN_5_ICON_1_1),this.storeTransferAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL62)){
				ves.add(createButton("商品报损", ImageFactory.loadImage(ImageFactory.FUN_5_ICON_2_2),this.commodityDamageAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL63)){
				ves.add(createButton( "物品领用", ImageFactory.loadImage(ImageFactory.FUN_5_ICON_3_3),this.articlesUsingAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL64)){
				ves.add(createButton( "其他方式出库存单", ImageFactory.loadImage(ImageFactory.FUN_5_ICON_4_4),this.otherReserveAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL65)){
				ves.add(createButton( "库存报警", ImageFactory.loadImage(ImageFactory.FUN_5_ICON_5_5),this.stockAlarmAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL66)){
				ves.add(createButton( "出入库存单查询", ImageFactory.loadImage(ImageFactory.FUN_5_ICON_6_6),this.stockInOutQueryAction));
			}
//			shortcutPane.setTitle("库存管理");
			reserveManagerPanel.setName("库存管理");
     		dialogDelegale.addJComponent(reserveManagerPanel);
		}else if(e.getSource()==journalingButton){
			//报表管理
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL71)){
				ves.add(createButton( "采购报表", ImageFactory.loadImage(ImageFactory.FUN_6_ICON_1_1),this.statementBuyAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL72)){
				ves.add(createButton(  "库存报表", ImageFactory.loadImage(ImageFactory.FUN_6_ICON_2_2),this.statementStockAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL73)){
				ves.add(createButton( "销售报表", ImageFactory.loadImage(ImageFactory.FUN_6_ICON_3_3),this.statementSalesAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL74)){
				ves.add(createButton( "资金报表", ImageFactory.loadImage(ImageFactory.FUN_6_ICON_4_4),this.statementMoneyAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL75)){
				ves.add(createButton( "利润报表", ImageFactory.loadImage(ImageFactory.FUN_6_ICON_5_5),this.statementProfitAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL76)){
				ves.add(createButton( "所有员工交班记录", ImageFactory.loadImage(ImageFactory.FUN_6_ICON_5_5),this.allWorkShiftTakeNotesPanelAction));
			}
			statementManagerPanel.setName("报表管理");
     		dialogDelegale.addJComponent(statementManagerPanel);
//			shortcutPane.setTitle("报表管理");
		}else if(e.getSource()==systemButton){
			//系统设置
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL81)){
				ves.add(createButton(  "操作日记管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_1_1),this.systemManageLogAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL82)){
				ves.add(createButton(  "角色权限管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_2_2),this.systemManagePrivilegeAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL83)){
				ves.add(createButton(  "系统配置设置", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_3_3),this.systemSetAllocationAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL84)){
				ves.add(createButton(  "条码生成管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_4_4),this.systemManageBarCodeAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL85)){
				ves.add(createButton(  "数据库备份还原", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_5_5),this.systemBackupReductionAction));
			}
			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL86)){
				ves.add(createButton(  "交班", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_5_5),this.workShiftPanelAction));
			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL87)){
//				ves.add(createButton(  "交班记录", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_5_5),this.workShiftTakeNotesPanelAction));
//			}
//			shortcutPane.setTitle("系统设置");
			systemManagerPanel.setName("系统设置");
			dialogDelegale.addJComponent(systemManagerPanel);
		}
//		else if(e.getSource()==marketingButton){
//			//营销管理
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0121)){
//				ves.add(createButton(  "满就送", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_1_1),this.systemGiftAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0123)){
//				ves.add(createButton(  "自定义优惠", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_2_2),this.systemCoupAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0124)){
//				ves.add(createButton(  "营销评估", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_3_3),this.systemMarKingLogAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0125)){
//				ves.add(createButton(  "优惠卷管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_5_5),this.memberCouponAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0126)){
//				ves.add(createButton(  "招聘管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_4_4),this.systemShopJobAction));
//			}
//			
////			shortcutPane.setTitle("系统设置");
//			systemMarketingFrame.setName("营销管理");
//			dialogDelegale.addJComponent(systemMarketingFrame);
//		}
//		else if(e.getSource()==permissionButton){
//			//权限管理
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0111)){
//				ves.add(createButton(  "权限管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_1_1),this.permissionsAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0112)){
//				ves.add(createButton(  "充值规则", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_2_2),this.shopChargeAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0113)){
//				ves.add(createButton(  "会员卡管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_3_3),this.memberCardAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0114)){
//				ves.add(createButton(  "新闻管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_4_4),this.newsAction));
//			}
//			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0115)){
//				ves.add(createButton(  "轮牌管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_5_5),this.shiftTypeAction));
//			}
////			if(ApplicationContext.TRIGHT_LIST.contains(ApplicationContext.RIGHT_LIVEL0116)){
////				ves.add(createButton(  "优惠卷管理", ImageFactory.loadImage(ImageFactory.FUN_7_ICON_5_5),this.memberCouponAction));
////			}
//			
////			shortcutPane.setTitle("系统设置");
//			permissionsFrame.setName("权限管理");
//			dialogDelegale.addJComponent(permissionsFrame);
//		}
		else if(e.getSource()==openUrlButton){
			//打开浏览器
			//网站向导
			if(ApplicationContext.SHOP_INFO!=null){
				Util.runBroswer(ApplicationContext.SHOP_INFO.getURL());
			}else{
				JOptionPane.showMessageDialog(null, "请先配置商店信息");
			}
		}
		shortcutPane.setListData(ves);
//		shortcutPane.getList().setListData(ves);
	}

	

	private JToggleButton createButton(String text,Icon icon,ActionListener action){
		JToggleButton jb=new RPSmailToolBarJButton(text);
		jb.setIcon(icon);
//		jb.setRolloverIcon(SwingConstants.LEFT);
//		jb.setPressedIcon(SwingConstants.CENTER);
		jb.setHorizontalTextPosition(SwingConstants.RIGHT);
		jb.setVerticalTextPosition(SwingConstants.CENTER);
		jb.setFocusPainted(false);
		jb.setBorderPainted(false);
		jb.setContentAreaFilled(false);
		jb.addActionListener(action);
		jb.setCursor(new Cursor(Cursor.HAND_CURSOR));
		return jb;
	}
	
	
	//会员消费面板
	public ActionListener memberBookAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			deskMianPanel.setName("预订外卖");
			dialogDelegale.addJComponent(deskMianPanel);
		}
	};
	//会员消费面板
		public ActionListener memberConsumptionAction = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				orderAddPanel.setName("菜品销售");
				dialogDelegale.addJComponent(orderAddPanel);
			}
		};
	//在线订面板
	public ActionListener orderOnlineAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			orderOnlinePanel.setName("在线订单");
			dialogDelegale.addJComponent(orderOnlinePanel);
			SwingUtilities.invokeLater(orderOnlinePanel);
		}
	};
	//在线订面板
	public ActionListener orderScheduledAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			orderScheduledPanel.setName("在线预订");
			dialogDelegale.addJComponent(orderScheduledPanel);
		}
	};
	//订单评论
	public ActionListener orderCommentsAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			orderCommentsPanel.setName("订单评论");
			dialogDelegale.addJComponent(orderCommentsPanel);
			SwingUtilities.invokeLater(orderCommentsPanel);
		}
	};
	//销售退货
	public ActionListener marketReturnedAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			marketReturnedPanel.setName("销售退货");
			dialogDelegale.addJComponent(marketReturnedPanel);
			SwingUtilities.invokeLater(marketReturnedPanel);
		}
	};
	//会员充值
	public ActionListener memberFillCardAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			menberFillCardPanel.setName("会员充值");
			dialogDelegale.addJComponent(menberFillCardPanel);
		}
	};
	//会员卡查询
	public ActionListener meberQueryCardAction = new ActionListener() {
		@Override
		/**
		 * 原代码
		 */
//		public void actionPerformed(ActionEvent e) {
//			meberQueryCardPanel.setName("会员卡查询");
//			dialogDelegale.addJComponent(meberQueryCardPanel);
//			SwingUtilities.invokeLater(meberQueryCardPanel);
//		}
		/**
		 * 更改
		 */
		public void actionPerformed(ActionEvent e) {
			memberCardPanel.setName("会员卡查询");
			dialogDelegale.addJComponent(memberCardPanel);
			SwingUtilities.invokeLater(memberCardPanel);
		}
		
	};
	//会员发卡
	public ActionListener memberCreateCardAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			menberCreateCardPanel.setName("会员发卡");
			dialogDelegale.addJComponent(menberCreateCardPanel);
		}
	};
	//领取礼包
	public ActionListener memberGiftAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			menberGiftPanel.setName("领取礼包");
			dialogDelegale.addJComponent(menberGiftPanel);
		}
	};
	//补卡
	public ActionListener memberLostCardAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			menberLostCardPanel.setName("会员补卡");
			dialogDelegale.addJComponent(menberLostCardPanel);
		}
	};
	//商品管理
	public ActionListener dataCommodityAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			dataCommodityPanel.setName("商品管理");
			dialogDelegale.addJComponent(dataCommodityPanel);
			SwingUtilities.invokeLater(dataCommodityPanel);
		}
	};
	//员工管理
	public ActionListener dataEmployeesAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			dataEmployeesPanel.setName("员工管理");
			dialogDelegale.addJComponent(dataEmployeesPanel);
			SwingUtilities.invokeLater(dataEmployeesPanel);
		}
	};
	//餐桌管理
	public ActionListener dataExePosAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			dataExePosPanel.setName("员工管理");
			dialogDelegale.addJComponent(dataExePosPanel);
			SwingUtilities.invokeLater(dataExePosPanel);
		}
	};
	//仓库管理
	public ActionListener dataStorageAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			dataStoragePanel.setName("仓库管理");
			dialogDelegale.addJComponent(dataStoragePanel);
			SwingUtilities.invokeLater(dataStoragePanel);
		}
	};
	//供应商管理
	public ActionListener dataSupplierAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			dataVendorPanel.setName("供应商管理");
			dialogDelegale.addJComponent(dataVendorPanel);
			SwingUtilities.invokeLater(dataVendorPanel);
		}
	};
	//商店管理
	public ActionListener dataShopAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			dataShopPanel.setName("商店管理");
			dialogDelegale.addJComponent(dataShopPanel);
			SwingUtilities.invokeLater(dataShopPanel);
		}
	};
	//采购进货
	public ActionListener purchaseEnterAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			purchaseEnterPanel.setName("采购进货");
			dialogDelegale.addJComponent(purchaseEnterPanel);
			SwingUtilities.invokeLater(purchaseEnterPanel);
		}
	};
	//采购退货
	public ActionListener purchaseRetreatAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			purchaseRetreatPanel.setName("采购退货");
			dialogDelegale.addJComponent(purchaseRetreatPanel);
			SwingUtilities.invokeLater(purchaseRetreatPanel);
		}
	};
	//商品报损
	public ActionListener commodityDamageAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			commodityDamagePanel.setName("商品报损");
			dialogDelegale.addJComponent(commodityDamagePanel);
			SwingUtilities.invokeLater(commodityDamagePanel);
		}
	};
	//物品领用
	public ActionListener articlesUsingAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			articlesUsingPanel.setName("物品领用");
			dialogDelegale.addJComponent(articlesUsingPanel);
			SwingUtilities.invokeLater(articlesUsingPanel);
		}
	};
	//其他方式出库存单
	public ActionListener otherReserveAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			otherReservePanel.setName("其他方式出库存单");
			dialogDelegale.addJComponent(otherReservePanel);
			SwingUtilities.invokeLater(otherReservePanel);
		}
	};
	//仓库调拨
	public ActionListener storeTransferAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			reserveAllotPanel.setName("仓库调拨");
			dialogDelegale.addJComponent(reserveAllotPanel);
			SwingUtilities.invokeLater(reserveAllotPanel);
		}
	};
	//库存报警
	public ActionListener stockAlarmAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			stockAlarmPanel.setName("库存报警");
			dialogDelegale.addJComponent(stockAlarmPanel);
			SwingUtilities.invokeLater(stockAlarmPanel);
		}
	};
	//出入库存单查询
	public ActionListener stockInOutQueryAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			stockInOutQuery.setName("出入库存单查询");
			dialogDelegale.addJComponent(stockInOutQuery);
			SwingUtilities.invokeLater(stockInOutQuery);
		}
	};
	
	//采购报表
	public ActionListener statementBuyAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			statementBuyPanel.setName("采购报表");
			dialogDelegale.addJComponent(statementBuyPanel);
		}
	};
	//库存报表
	public ActionListener statementStockAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			statementStockPanel.setName("库存报表");
			dialogDelegale.addJComponent(statementStockPanel);
		}
	};
	//销售报表
	public ActionListener statementSalesAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			statementSalesPanel.setName("销售报表");
			dialogDelegale.addJComponent(statementSalesPanel);
		}
	};
	//资金报表
	public ActionListener statementMoneyAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			statmentMoneyPanel.setName("资金报表");
			dialogDelegale.addJComponent(statmentMoneyPanel);
		}
	};
	//利润报表
	public ActionListener statementProfitAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			statementProfitPanel.setName("利润报表");
			dialogDelegale.addJComponent(statementProfitPanel);
		}
	};
	
	//所有员工交班记录
	public ActionListener allWorkShiftTakeNotesPanelAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			allWorkShiftTakeNotesPanel.setName("所有员工交班记录");
			dialogDelegale.addJComponent(allWorkShiftTakeNotesPanel);
			SwingUtilities.invokeLater(allWorkShiftTakeNotesPanel);
		}
	};
	
	//操作日志
	public ActionListener systemManageLogAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			systemManageLog.setName("操作日志");
			dialogDelegale.addJComponent(systemManageLog);
			SwingUtilities.invokeLater(systemManageLog);
		}
	};
	//角色管理
	public ActionListener systemManagePrivilegeAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			//systemManagePrivilege
			permissionsPanel.setName("角色管理");
			dialogDelegale.addJComponent(permissionsPanel);
			SwingUtilities.invokeLater(permissionsPanel);
		}
	};
	//系统配置
	public ActionListener systemSetAllocationAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			systemSetAllocation.setName("系统配置");
			dialogDelegale.addJComponent(systemSetAllocation);
		}
	};
	//条形码生成
	public ActionListener systemManageBarCodeAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			systemManageBarCode.setName("条形码生成");
			dialogDelegale.addJComponent(systemManageBarCode);
		}
	};
	//数据库备份还原
	public ActionListener systemBackupReductionAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			SystemBackupReduction.setName("数据库备份还原");
			dialogDelegale.addJComponent(SystemBackupReduction);
		}
	};
	//交班
	public ActionListener workShiftPanelAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			workShiftPanel.setName("交班");
			dialogDelegale.addJComponent(workShiftPanel);
			SwingUtilities.invokeLater(workShiftPanel);
		}
	};
//	//交班记录
//	public ActionListener workShiftTakeNotesPanelAction = new ActionListener() {
//		@Override
//		public void actionPerformed(ActionEvent e) {
//			workShiftTakeNotesPanel.setName("交班记录");
//			dialogDelegale.addJComponent(workShiftTakeNotesPanel);
//		}
//	};
	//---------------------------------------------------------------
	//满就送
	public ActionListener systemGiftAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			selectGiftPanel.setName("满就送");
			dialogDelegale.addJComponent(selectGiftPanel);
			SwingUtilities.invokeLater(selectGiftPanel);
		}
	};
	//自定义优惠
	public ActionListener systemCoupAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			selectCouponPanel.setName("自定义优惠");
			dialogDelegale.addJComponent(selectCouponPanel);
			SwingUtilities.invokeLater(selectCouponPanel);
		}
	};
	//营销评估
	public ActionListener systemMarKingLogAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			markePanel.setName("营销评估");
			dialogDelegale.addJComponent(markePanel);
			SwingUtilities.invokeLater(markePanel);
		}
	};
	//招聘管理
	public ActionListener systemShopJobAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			shopJobPanel.setName("招聘管理");
			dialogDelegale.addJComponent(shopJobPanel);
			SwingUtilities.invokeLater(shopJobPanel);
		}
	};
	//权限管理
	public ActionListener permissionsAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			permissionsPanel.setName("权限管理");
			dialogDelegale.addJComponent(permissionsPanel);
			SwingUtilities.invokeLater(permissionsPanel);
		}
	};
	//充值规则
	public ActionListener shopChargeAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			shopChargePanel.setName("充值规则");
			dialogDelegale.addJComponent(shopChargePanel);
			SwingUtilities.invokeLater(shopChargePanel);
		}
	};
	//会员管理
	public ActionListener memberCardAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			memberCardPanel.setName("会员管理");
			dialogDelegale.addJComponent(memberCardPanel);
			SwingUtilities.invokeLater(memberCardPanel);
		}
	};
	//新闻管理
	public ActionListener newsAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			newsPanel.setName("新闻管理");
			dialogDelegale.addJComponent(newsPanel);
			SwingUtilities.invokeLater(newsPanel);
		}
	};
	//轮牌管理
	public ActionListener shiftTypeAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			shiftTypePanel.setName("轮牌管理");
			dialogDelegale.addJComponent(shiftTypePanel);
			SwingUtilities.invokeLater(shiftTypePanel);
		}
	};
	//优惠卷管理
	public ActionListener memberCouponAction = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			memberCouponPanel.setName("优惠卷管理");
			dialogDelegale.addJComponent(memberCouponPanel);
			SwingUtilities.invokeLater(memberCouponPanel);
		}
	};
	
	
	
//	@Override
//    protected void paintComponent(Graphics g) {
//        Graphics2D g2d = (Graphics2D) g;
//        //fill background.
//        g2d.setPaint(paint);
//        g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
//        //draw right image.
//        int x = this.getWidth() - backgroundRightImage.getWidth(null);
//        int y = 0;
//        g2d.drawImage(backgroundRightImage, x, y, null);
//        //draw left image.
//        g2d.drawImage(backgroundLeftImage, 0, 0, null);
//    }
	
	public void setDialogDelegale(DialogDelegale dialogDelegale) {
		this.dialogDelegale = dialogDelegale;
	}
	
	class CapListener implements AWTEventListener {
		public void eventDispatched(AWTEvent event) {
			if(onNumber==0){
				int code=((KeyEvent) event).getKeyCode();
				if (code == KeyEvent.VK_F1) {
					orderButton.doClick();
				}else if(code == KeyEvent.VK_F2){
					memberButton.doClick();
				}else if(code == KeyEvent.VK_F3){
					dataButton.doClick();
				}else if(code == KeyEvent.VK_F4){
					purchaseButton.doClick();
				}else if(code == KeyEvent.VK_F5){
					reserveButton.doClick();
				}else if(code == KeyEvent.VK_F6){
					journalingButton.doClick();
				}else if(code == KeyEvent.VK_F7){
					systemButton.doClick();
				}else if(code == KeyEvent.VK_F8){
					openUrlButton.doClick();
				}else if(code == KeyEvent.VK_F9){
					permissionButton.doClick();
				}else 
					onNumber++;
			}else{
				onNumber=0;
			}
		}
	}
	
	public void showData() {
		if (this.getComponentCount() >= 2) {
			((JToggleButton)this.getComponent(1)).doClick();
		}
	}
}
